﻿<ListBox x:Class="BadHabit.Factory.Controls.BacklogItemListBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      
    xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
         
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"
         
    SnapsToDevicePixels="True"                
    DataContextChanged="UserControl_DataContextChanged"
    Loaded="UserControl_Loaded"
         
    x:Name="listBox"                                  
                                                
    IsSynchronizedWithCurrentItem="True"    
    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
    
    SelectionMode="Multiple"                               
    BorderThickness="0,0,0,0"    
    Background="Transparent"                                                          
    SelectionChanged="listBox_SelectionChanged">

    <ListBox.ItemTemplate>

        <DataTemplate >

            <Grid
                        AllowDrop="True"
                        Drop="BacklogItem_Drop"
                        
                        DragOver="BacklogItem_DragOver">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>


                <TextBlock Grid.Column="0" Text="{Binding BacklogItemNumber}" TextAlignment="Right" VerticalAlignment="Top" Margin="0,0,3,0"/>
                <Image Grid.Column="1" Style="{StaticResource BacklogItemStatusImage}" VerticalAlignment="Top" HorizontalAlignment="Center" DataContext="{Binding Status}" Width="16" Height="16" Margin="0,0,5,0"/>


                <TextBlock Grid.Column="2" Text="{Binding Title}" TextWrapping="Wrap" VerticalAlignment="Top" >
                    <Image Style="{StaticResource VerifiedImage}" Width="10" Height="10" Margin="5,0,0,0" VerticalAlignment="Top" />
                </TextBlock>

                <Grid.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="{x:Static props:Resources.Details}" Click="detailsMenuItem_Click"/>
                    </ContextMenu>
                </Grid.ContextMenu>

            </Grid>
        </DataTemplate>

    </ListBox.ItemTemplate>


    <ListBox.ItemContainerStyle>
        <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource HorizontalDividedListBoxItem}"/>                    
    </ListBox.ItemContainerStyle>    
    <ListBox.GroupStyle>
        <GroupStyle>
            <GroupStyle.HeaderTemplate>
                <DataTemplate>                    
                        <TextBlock Text="{Binding Name, StringFormat='{}Sprint {0}'}" Foreground="{StaticResource DarkTextBrush}" FontSize="13" Margin="0,5,0,3" />                    
                </DataTemplate>
            </GroupStyle.HeaderTemplate>            
        </GroupStyle>        
    </ListBox.GroupStyle>
    

</ListBox>
